# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: reporter\generators\generic.py
__author__ = "r4w8173"
known_vulnerability_type_tags = {
    "arbitrary_file_creation",
    "code_execution",
    "ssrf",
    "unauthenticated_file_upload",
    "authentication_bypass",
    "url_redirection",
    "directory_listing",
    "privilege_escalation",
    "error_handling",
    "xpath_injection",
    "session_fixation",
    "rce",
    "insecure_admin_access",
    "test_files",
    "abuse_of_functionality",
    "default_credentials",
    "buffer_overflow",
    "directory_traversal",
    "http_parameter_pollution",
    "sql_injection",
    "sensitive_data_not_over_ssl",
    "xss",
    "csrf",
    "malware",
    "needless_service",
    "ldap_injection",
    "file_inclusion",
    "internal_ip_disclosure",
    "xxe",
    "xfs",
    "network_alert",
    "bruteforce_possible",
    "http_response_splitting",
    "crlf_injection",
    "weak_crypto",
    "remote_code_execution",
    "configuration",
    "source_code_disclosure",
    "weak_credentials",
    "denial_of_service",
    "information_disclosure",
}


class DataSource:
    def info(self):
        """
        required fields: avg_response_time, os, max_response_time, aborted, progress, responsive, duration, technologies
                         host, request_count, aborted_reason, server, sensor, start_date, end_date
        :return:
        """
        raise NotImplementedError()

    def locations(self):
        """
        required fields: loc_type, source_id, root_id, parent_id, name, tags, input_data, url, path, loc_id
        :return:
        """
        raise NotImplementedError()

    @staticmethod
    def extract_vuln_type_from_tags(tags):
        try:
            for tag in tags:
                if tag in known_vulnerability_type_tags:
                    return tag.replace("_", "")

        except Exception:
            pass

        return ""

    def vulnerability_types(self):
        """
        required fields: (vuln_type, count)
        vuln_type: cvss3, long_description, name, recommendation, cvss_score, description, cvss, tags, vt_id,
                   references, severity, impact, app_id
        :return:
        """
        raise NotImplementedError()

    def vulnerabilities(self, vtype=None, location=None, tags=None, severity=None):
        """
        required fields: (vuln, location, vuln_type)
        vuln: loc_url, details_type, host, vt_id, vuln_hash, request, source, loc_id, details, app_id, loc_detail
        :param vtype:
        :param location:
        :param tags:
        :param severity:
        :return:
        """
        raise NotImplementedError()
